home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / AMIGA / AMICUS / AMICUS03.ADF / ABasiCprogs / poker.bas < prev    next >
BASIC Source File  |  1986-04-02  |  11KB  |  328 lines

  1. 5     zx=0
  2. 10    scnclr
  3. 11    gosub 7000
  4. 12    y=120:gosub 7100
  5. 15    rgb 0,5,15,0
  6. 25    circle(138,28),30
  7. 27    pena 11:paint(159,10)
  8. 28    penb 7:pena 1:?at(110,30);" BET ? "
  9. 29    d=0:bet=0
  10. 30    ask mouse x%,y%,b%
  11. 32    if b%=4 and y%<60 then ?at(130,70);"or":circle(138,90),40,.25:paint(130,90):pena 2:penb 1:?at(122,93);"DEAL":d=1:bet=bet+1:?at(120,40);"$"bet
  12. 33    if b%=4 and y%<60 then pot=pot-1:gosub 7000
  13. 35    if b%=4 and y%>80 and d=1 then 40
  14. 39    goto 30
  15. 40    scnclr
  16. 45    y=10:gosub 7100:y=100
  17. 50    x=-2:y=100
  18. 51    gosub 60:gosub 61
  19. 52    x=59:gosub 60:gosub 61
  20. 53    x=120:gosub 60:gosub 61
  21. 54    x=181:gosub 60:gosub 61
  22. 55    x=242:gosub 60:gosub 61
  23. 56    goto 70
  24. 60    gshape(x,y),card53%
  25. 61    for t=1 to 500:next:return
  26. 70    '
  27. 100   rem
  28. 110   randomize
  29. 120   c=int(rnd(9)*52+1)
  30. 125   c1=c:x=-2:y=100
  31. 128   gosub 1000
  32. 130   c=int(rnd(9)*52+1)
  33. 135   c2=c:x=59
  34. 136   if c2=c1 then 130
  35. 138   gosub 1000
  36. 140   c=int(rnd(9)*52+1)
  37. 145   c3=c:x=120
  38. 146   if c3=c2 or c3=c1 then 140
  39. 148   gosub 1000
  40. 150   c=int(rnd(9)*52+1)
  41. 155   c4=c:x=181
  42. 156   if c4=c3 or c4=c2 or c4=c1 then 150
  43. 158   gosub 1000
  44. 160   c=int(rnd(9)*52+1)
  45. 165   c5=c:x=242
  46. 166   if c5=c4 or c5=c3 or c5=c2 or c5=c1 then 150
  47. 168   gosub 1000
  48. 500   '
  49. 510   graphic 1
  50. 515   penb 2
  51. 519   goto 565
  52. 520   pena 1:? at (6 ,95);" HOLD "
  53. 530   ?at(66,95);" HOLD "
  54. 540   ?at(128,95);" HOLD "
  55. 550   ?at(188,95);" HOLD "
  56. 560   ?at(248,95);" HOLD "
  57. 565   h1=0:h2=0:h3=0:h4=0:h5=0
  58. 568   pena 1
  59. 570   ?at(55,85);"  select cards to hold  "
  60. 572   Y=10:GOSUB 7100:Y=100
  61. 575   penb 4:?at(83,65);" THE BET IS $"bet
  62. 580   penb 7:?at(66,180);"   draw when ready   "
  63. 581   ?at(66,50); "       draw          "
  64. 600   rem
  65. 610   ask mouse x%,y%,b%
  66. 615   if b%=4 and y%>95  goto 620
  67. 616   if b%=4 and y%<50 goto 700
  68. 619   goto 600
  69. 620   if x%<60 and h1=0 then penb 4:?at(6,95);" HELD ":h1=1:goto 670
  70. 621   if x%<60 and h1=1 then penb 0:?at(6,95);"      ":h1=0:goto 670
  71. 630   if x%>60 and x%<120 and h2=0 then penb 4:?at(66,95);" HELD ":h2=1:goto 670
  72. 631   if X%>60 and x%<120 and h2=1 then penb 0:?at(66,95);"      ":h2=0:goto 670
  73. 640   if x%>120 and x%<180 and h3=0 then penb 4:?at(128,95);" HELD ":h3=1 :goto 670
  74. 641   if x%>120 and x%<180 and h3=1 then penb 0:?at(128,95);"      ":h3=0:goto 670
  75. 650   if x%>180 and x%<240 and h4=0 then penb 4:?at(188,95);" HELD ":h4=1:goto 670
  76. 651   if x%>180 and x%<240 and h4=1 then penb 0:?at(188,95);"      ":h4=0:goto 670
  77. 660   if x%>240 and h5=0 then penb 4:?at(248,95);" HELD ":h5=1:goto 670
  78. 661   if x%>240 and h5=1 then penb 0:?at(248,95);"      ":h5=0:goto 670
  79. 670   for t=1 to 1000:next:goto 600
  80. 690   goto 600
  81. 700   rem ****deal remaining cards**
  82. 701   if h1=0 then x=-2:gosub 60
  83. 702   if h2=0 then x=59:gosub 60
  84. 703   if h3=0 then x=120:gosub 60
  85. 704   if h4=0 then x=181:gosub 60
  86. 705   if h5=0 then x=242:gosub 60
  87. 710   if h1=0 then c=int(rnd(9)*52+1):c6=c:x=-2:if c6=c5 or c6= c4 or c6=c3 or c6=c2 or c6=c1 then 710:gosub 1000
  88. 730   if h2=0 then c=int(rnd(9)*52+1):c7=c:x=59:if c7=c6 or c7= c5 or c7=c4 or c7=c3 or c7=c2 or c7=c1 then 730:gosub 1000
  89. 740   if h3=0 then c=int(rnd(9)*52+1):c8=c:x=120:if c8=c7 or c8=c6 or c8=c5 or c8=c4 or c8=c3 or c8=c2 or c8=c1 then 740:gosub 1000
  90. 750   if h4=0 then c=int(rnd(9)*52+1):c9=c:x=181:if c9=c8 or c9=c7 or c9=c6 or c9=c5 or c9=c4 or c9=c3 or c9=c2 or c9=c1 then 740:gosub 1000
  91. 760   if h5=0 then c=int(rnd(9)*52+1):c10=c:x=242:if c10=c9 or c10=c8 or c10=c7 or c10=c6 or c10=c5 or c10=c4 or c10=c3 or c10=c2 or c10=c1 then 760:gosub 1000
  92. 765   gosub 770:goto 780
  93. 770   penb 0:?at(55,85);"                          "
  94. 771   ?at(66,180);"                     "
  95. 775   return
  96. 780   if h1=0 then c1=c6
  97. 781   if h2=0 then c2=c7
  98. 782   if h3=0 then c3=c8
  99. 783   if h4=0 then c4=c9
  100. 785   if h5=0 then c5=c10
  101. 790   goto 1900
  102. 800   '
  103. 1000  rem
  104. 1010  if c=1 then gshape(x,y),card1%
  105. 1020  if c=2 then gshape(x,y),card2%
  106. 1030  if c=3 then gshape(x,y),card3%
  107. 1040  if c=4 then gshape(x,y),card4%
  108. 1050  if c=5 then gshape(x,y),card5%
  109. 1060  if c=6 then gshape(x,y),card6%
  110. 1070  if c=7 then gshape(x,y),card7%
  111. 1080  if c=8 then gshape(x,y),card8%
  112. 1090  if c=9 then gshape(x,y),card9%
  113. 1100  if c=10 then gshape(x,y),card10%
  114. 1110  if c=11 then gshape(x,y),card11%
  115. 1120  if c=12 then gshape(x,y),card12%
  116. 1130  if c=13 then gshape(x,y),card13%
  117. 1140  if c=14 then gshape(x,y),card14%
  118. 1150  if c=15 then gshape(x,y),card15%
  119. 1160  if c=16 then gshape(x,y),card16%
  120. 1170  if c=17 then gshape(x,y),card17%
  121. 1180  if c=18 then gshape(x,y),card18%
  122. 1190  if c=19 then gshape(x,y),card19%
  123. 1200  if c=20 then gshape(x,y),card20%
  124. 1210  if c=21 then gshape(x,Y),card21%
  125. 1220  if c=22 then gshape(x,y),card22%
  126. 1230  if c=23 then gshape(x,y),card23%
  127. 1240  if c=24 then gshape(x,y),card24%
  128. 1250  if c=25 then gshape(x,y),card25%
  129. 1260  if c=26 then gshape(x,y),card26%
  130. 1270  if c=27 then gshape(x,y),card27%
  131. 1280  if c=28 then gshape(x,y),card28%
  132. 1290  if c=29 then gshape(x,y),card29%
  133. 1300  if c=30 then gshape(x,y),card30%
  134. 1310  if c=31 then gshape(x,y),card31%
  135. 1320  if c=32 then gshape(x,y),card32%
  136. 1330  if c=33 then gshape(x,y),card33%
  137. 1340  if c=34 then gshape(x,y),card34%
  138. 1350  if c=35 then gshape(x,y),card35%
  139. 1360  if c=36 then gshape(x,y),card36%
  140. 1370  if c=37 then gshape(x,y),card37%
  141. 1380  if c=38 then gshape(x,y),card38%
  142. 1390  if c=39 then gshape(x,y),card39%
  143. 1400  if c=40 then gshape(x,y),card40%
  144. 1410  if c=41 then gshape(x,y),card41%
  145. 1420  if c=42 then gshape(x,y),card42%
  146. 1430  if c=43 then gshape(x,y),card43%
  147. 1440  if c=44 then gshape(x,y),card44%
  148. 1450  if c=45 then gshape(x,y),card45%
  149. 1460  if c=46 then gshape(x,y),card46%
  150. 1470  if c=47 then gshape(x,y),card47%
  151. 1480  if c=48 then gshape(x,y),card48%
  152. 1490  if c=49 then gshape(x,y),card49%
  153. 1500  if c=50 then gshape(x,y),card50%
  154. 1510  if c=51 then gshape(x,y),card51%
  155. 1520  if c=52 then gshape(x,y),card52%
  156. 1600  return
  157. 1900  rem if zx=0 then chain merge "win",2000:zx=1
  158. 2000  rem calculate winnings
  159. 2003  zx=1
  160. 2004  flu=0:str=0
  161. 2005  H$="hcds"
  162. 2006  C$="123456789TJQK"
  163. 2010  ?at(77,80);"CALCULATE WINNINGS"
  164. 2011  s=1:v=c1:gosub 2020:a=q
  165. 2012  v=c2:gosub 2020:b=q
  166. 2013  v=c3:gosub 2020:c=q
  167. 2014  v=c4:gosub 2020:d=q
  168. 2015  v=c5:gosub 2020:e=q
  169. 2019  goto 2030
  170. 2020  t=int((v-1)/13):q=v-t*13
  171. 2021  k$(s) = mid$ (H$,t+1,1)
  172. 2022  n$(s)=mid$(c$,q,1)
  173. 2023  rem: ?k$(s)
  174. 2024  rem: ?n$(s)
  175. 2026  s=s+1
  176. 2029  return
  177. 2030  rem goto subroutine check for straight or ROYAL
  178. 2032  if K$(1)=K$(2) and K$(1)=K$(3) and K$(1)=K$(4) and K$(1)=k$(5) then flu=1:goto 3000
  179. 2040  rem ** 4 of kind
  180. 2041  if a=b and a=c and a=d then 5030
  181. 2042  if a=c and a=d and a=e then 5030
  182. 2043  if a=b and a=d and a=e then 5030
  183. 2044  if a=b and a=c and a=e then 5030
  184. 2045  if b=c and b=d and b=e then 5030
  185. 2050  if a=b and a=c then if d=e then 5040
  186. 2051  if a=c and a=d then if b=e then 5040
  187. 2052  if a=c and a=e then if b=d then 5040
  188. 2053  if a=b and a=d then if c=e then 5040
  189. 2054  if a=b and a=e then if c=d then 5040
  190. 2055  if a=d and a=e then if b=c then 5040
  191. 2056  if b=c and b=d then if a=e then 5040
  192. 2057  if b=c and b=e then if a=d then 5040
  193. 2058  if c=d and c=e then if a=b then 5040
  194. 2059  if b=d and b=e then if a=c then 5040
  195. 2060  if a=b and a=c then 5070
  196. 2061  if a=c and a=d then 5070
  197. 2062  if a=c and a=e then 5070
  198. 2063  if a=b and a=d then 5070
  199. 2064  if a=b and a=e then 5070
  200. 2065  if a=d and a=e then 5070
  201. 2066  if b=c and b=d then 5070
  202. 2067  if b=c and b=e then 5070
  203. 2068  if c=d and c=e then 5070
  204. 2069  if b=d and b=e then 5070
  205. 2070  if a=b and c=d then 5080
  206. 2071  if a=b and c=e then 5080
  207. 2072  if a=c and b=d then 5080
  208. 2073  if a=c and b=e then 5080
  209. 2074  if a=d and b=c then 5080
  210. 2075  if a=d and b=e then 5080
  211. 2076  if a=e and b=c then 5080
  212. 2077  if a=e and b=d then 5080
  213. 2078  if b=c and d=e then 5080
  214. 2079  if a=c and d=e then 5080
  215. 2080  if a=e and c=d then 5080
  216. 2081  if a=b and d=e then 5080
  217. 2082  if a=b and b=e then 5080
  218. 2083  if b=e and c=d then 5080
  219. 2084  if a=d and c=e then 5080
  220. 2085  IF B=D AND C=E THEN 5080
  221. 2090  rem 1 pair
  222. 2091  if a=b or a=c or a=d or a=e then j=a:goto 5090
  223. 2092  if b=c or b=d or b=e then j=b:goto 5090
  224. 2093  if c=d or c=e then j=c:goto 5090
  225. 2094  if d=e then j=d:goto 5090
  226. 2095  '
  227. 2096  '
  228. 2097  rem goto 5095
  229. 3000  rem sort straights and royal
  230. 3002  if a=1 then if b=13 or c=13 or d=13 or e=13 then a=14
  231. 3003  if b=1 then if a=13 or c=13 or d=13 or e=13 then b=14
  232. 3004  if c=1 then if a=13 or b=13 or d=13 or e=13 then c=14
  233. 3005  if d=1 then if a=13 or b=13 or c=13 or e=13 then d=14
  234. 3006  if e=1 then if a=13 or b=13 or c=13 or d=13 then e=14
  235. 3010  for s=1 to 15
  236. 3011  if s=a then t=a:a=0:goto 3020
  237. 3012  if s=b then t=b:b=0:goto 3020
  238. 3013  if s=c then t=c:c=0:goto 3020
  239. 3014  if s=d then t=d:d=0:goto 3020
  240. 3015  if s=e then t=e:e=0:goto 3020
  241. 3016  next
  242. 3020  for s=1 to 15
  243. 3021  if s=a then u=a:a=0:goto 3030
  244. 3022  if s=b then u=b:b=0:goto 3030
  245. 3023  if s=c then u=c:c=0:goto 3030
  246. 3024  if s=d then u=d:d=0:goto 3030
  247. 3025  if s=e then u=e:e=0:goto 3030
  248. 3026  next
  249. 3030  for s=1 to 15
  250. 3031  if s=a then v=a:a=0:goto 3040
  251. 3032  if s=b then v=b:b=0:goto 3040
  252. 3033  if s=c then v=c:c=0:goto 3040
  253. 3034  if s=d then v=d:d=0:goto 3040
  254. 3035  if s=e then v=e:e=0:goto 3040
  255. 3036  next
  256. 3040  for s=1 to 15
  257. 3041  if s=a then y=a:a=0:goto 3050
  258. 3042  if s=b then y=b:b=0:goto 3050
  259. 3043  if s=c then y=c:c=0:goto 3050
  260. 3044  if s=d then y=d:d=0:goto 3050
  261. 3045  if s=e then y=e:e=0:goto 3050
  262. 3046  next
  263. 3050  for s=1 to 15
  264. 3051  if s=a then z=a:goto 3060
  265. 3052  if s=b then z=b:goto 3060
  266. 3053  if s=c then z=c:goto 3060
  267. 3054  if s=d then z=d:goto 3060
  268. 3055  if s=e then z=e:goto 3060
  269. 3056  next
  270. 3060  '
  271. 3070  if t+1=u and u+1=v and v+1=y and y+1=z then str=1  
  272. 3079  if str=1 and flu=1 and z=14 then 5010
  273. 3080  if str=1 and flu=1 then 5020
  274. 3083  if str=1 then 5060
  275. 3085  if flu=1 then 5050
  276. 3087  rem royal ???????
  277. 3089  goto 5095
  278. 5000  rem calculate pay-out.=po
  279. 5010  ?"ROYAL FLUSH":PO=250
  280. 5015  goto 5100
  281. 5020  ?"STRAIGHT FLUSH":PO=50
  282. 5025  goto 5100
  283. 5030  ?"4 OF A KIND":PO=25
  284. 5035  goto 5100
  285. 5040  ?"FULL HOUSE":PO=8
  286. 5045  goto 5100
  287. 5050  ?"FLUSH":PO=5
  288. 5055  goto 5100
  289. 5060  ?"STRAIGHT":PO=4
  290. 5065  goto 5100
  291. 5070  ?"3 OF A KIND":PO=3
  292. 5075  goto 5100
  293. 5080  ?"2 PAIRS":PO=2
  294. 5085  goto 5100
  295. 5090  ?"ONE PAIR ";:PO=1
  296. 5091  if j=1 then j=14
  297. 5092  if j<11 then ?"--YOU NEED JACKS OR BETTER ":po=0:goto 5110
  298. 5094  goto 5100
  299. 5095  ?"NOTHING":PO=0
  300. 5100  '
  301. 5105  pot=pot+(bet*po)
  302. 5106  ?at (170,88);"YOU WIN $";bet*po
  303. 5110  gosub 7000
  304. 6000  rem
  305. 6003  pena 4:penb 6
  306. 6005  ?at(20,150);"  TRY AGAIN    OR      QUIT  "
  307. 6010  ask mouse x%,y%,b%:if b%=4 and x%<160 then 10
  308. 6012  if b%=4 then chain "casino",37,all
  309. 6014  gosub 6080
  310. 6015  ?at(20,150);"              "
  311. 6017  ?at(200,150);"QUIT ?"
  312. 6018  gosub 6080
  313. 6021  ?at(20,150);"  TRY AGAIN ?"
  314. 6025  ?at(200,150);"      "
  315. 6050  goto 6010
  316. 6080  sleep 1*10^5:return
  317. 7000  rem
  318. 7010  ?at(30,9);"YOU HAVE $";pot;"IN YOUR POCKET"
  319. 7020  return
  320. 7100  rem
  321. 7105  PENB 7
  322. 7110  ?at(60,y );"ROYAL FLUSH PAYS 250:1"
  323. 7120  ?"STRAIGHT FLUSH 20:1     FLUSH      5:1  "
  324. 7130  ?"4 OF KIND      25:1     3 OF KIND  3:1    "
  325. 7140  ?"FULL HOUSE      8:1     2 PAIR     2:1 "
  326. 7150  ?"STRAIGHT        4:1     JACKS +    1:1"
  327. 7200  RETURN
  328.